package com.dddd.blog.bloguser.mapper;

import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.dddd.blog.api.user.pojo.User;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;
import java.util.Map;

/**
 * <p>
 * 用户表 Mapper 接口
 * </p>
 *
 * @author dddd
 * @since 2022-02-27
 */
@Mapper
public interface UserMapper extends BaseMapper<User> {

    /**
     * 返回用户 list
     * @param queryWrapper
     * @return userList
     */
    @Override
    @Select("select * from ums_user")
    List<User> selectList(Wrapper<User> queryWrapper);



    /**
     * 将 spider map列表添加到user数据库
     * @param list
     * @return
     */
    @Insert("insert into ums_user(level_id,username,nickname,gender,uuid,home_link,password,email,growth,role_id) values( " +
            "1,#{username},#{username},2,#{uuid},#{home_link},'1234','1234@test',10,2)")
    int addUserWithAuthor(Map<String,Object> list);


    /**
     * @param list
     * @return
     */
    int addUserWithAuthors(List<Map<String,Object>> list);
}
